/*
 * UserActionsController.java
 *
 * Created on October 22, 2008, 4:17 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.vacuela.publishmx.web.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import org.vacuela.publishmx.context.ServiceContext;
import org.vacuela.publishmx.services.AdminService;
import org.vacuela.publishmx.util.PublishUtil;

/**
 *
 * @author nestor.carrasco
 */
public class UserActionsController extends PublishBasedController{
    private AdminService svcAdmin;
    
    public void setAdminService(AdminService admin){
        svcAdmin = admin;
    }

    
    /** Creates a new instance of UserActionsController */
    public UserActionsController() {
    }

  public ModelAndView commandAction(HttpServletRequest request, 
                HttpServletResponse response, ServiceContext context) throws Exception {
             String userId = PublishUtil.checkNull(request.getParameter("userAction"),"");
        if ( !"".equals(userId)){
                 context.setAttribute("userId",userId);
            this.svcAdmin.deleteUser(context);
        }
        return new ModelAndView("home");
    }
    
}
